/**
 Do not return anything, modify nums in-place instead.
 */
function reverse(nums: number[], start: number, end: number): void {
    while (start < end) {
        const temp = nums[start];
        nums[start] = nums[end];
        nums[end] = temp;
        start++;
        end--;
    }
}

function rotate(nums: number[], k: number): void {
    k%=nums.length;
    // console.log(k);
    reverse(nums, 0, nums.length - 1);
    reverse(nums, 0, k - 1);
    reverse(nums, k, nums.length - 1);
};
const nums11 = [1, 2, 3, 4, 5, 6, 7], k = 3;
rotate(nums11, k);